package d7_homework.d3_homeworkday06.d4_fourthquestion;

import java.util.Objects;

//订单类
public class ProductItem {
    //订单项id
    private int productItemId;
    //订单项编号
    private int productItemIdNumber;
    //商品编号
    private int productNumber;
    //商品名称
    private String productName;
    //商品价格
    private double price;

    public ProductItem() {
    }

    public ProductItem(int productItemId, int productItemIdNumber,
                       int productNumber,
                       String productName, double price) {
        this.productItemId = productItemId;
        this.productItemIdNumber = productItemIdNumber;
        this.productNumber = productNumber;
        this.productName = productName;
        this.price = price;
    }

    @Override
    public String toString() {
        return "ProductItem{" +
                "productItemId=" + productItemId +
                ", productItemIdNumber=" + productItemIdNumber +
                ", productNumber=" + productNumber +
                ", productName='" + productName + '\'' +
                ", price=" + price +
                '}';
    }

    public int getProductItemId() {
        return productItemId;
    }

    public void setProductItemId(int productItemId) {
        this.productItemId = productItemId;
    }

    public int getProductItemIdNumber() {
        return productItemIdNumber;
    }

    public void setProductItemIdNumber(int productItemIdNumber) {
        this.productItemIdNumber = productItemIdNumber;
    }

    public int getProductNumber() {
        return productNumber;
    }

    public void setProductNumber(int productNumber) {
        this.productNumber = productNumber;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ProductItem that = (ProductItem) o;
        return productItemId == that.productItemId && productItemIdNumber == that.productItemIdNumber && productNumber == that.productNumber && Double.compare(that.price, price) == 0 && Objects.equals(productName, that.productName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(productItemId, productItemIdNumber, productNumber, productName, price);
    }
}
